﻿@model IEnumerable<DslamPort.Models.ReportMytvModel>
<div align="center">
    <h1>
        BÁO CÁO TỔNG QUÁT THUÊ BAO MYTV</h1>
        <br>
</div>
<div class="container_12">
    <div class="grid_12">
        @if (TempData["msg"] != null)
        {                            
            <span class="notification n-success">@TempData["msg"]</span>
        }
        @if (TempData["error"] != null)
        {                            
            <span class="notification n-error">@TempData["error"]</span>
        }
        @using (Html.BeginForm("FindReportMytv", "ReportMytv", FormMethod.Post, new { id = "FindReportMytv", name = "FindReportMytv" }))
        {
            
            <p style="text-align: left; width: 43%; padding-left: 5px">
                Đơn vị:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                @if (ViewBag.donvi != null)
                {                               
                    @Html.DropDownList("quan_huyen_id", ViewBag.donvi as SelectList, "---Tất cả---", new { style = "width: 37%;" })                               
                }
                <input class="submit-green" type="submit" value="Tìm kiếm" />
            </p> 
            <br />
            <div class="bottom-spacing">
                <a href="@Url.Action("Export_Excel", "ReportMytv", new { type=0})">Export Excel</a>
            </div>
        }
        <div class="module">
            <h2>
                <span></span>
            </h2>
            <div class="module-table-body">
                <div class="scrolling">
                    <div class="data-table" style="width: 140%">
                        <table id="myTable" class="tablesorter">
                            <thead>
                                <tr>
                                    <th style="width: 4%">
                                        STT
                                    </th>
                                    <th style="width: 10%">
                                        Tên đơn vị
                                    </th>
                                    <th style="width: 15%">
                                        SYSTEM ID
                                    </th>
                                    <th style="width: 15%">
                                        Tên thiết bị
                                    </th>
                                    <th style="width: 10%">
                                        IP
                                    </th>
                                    <th style="width: 4%">
                                        Loại
                                    </th>
                                    @*<th style="width: 15%">
                                        Tổng số cổng
                                    </th>*@
                                    <th style="width: 10%">
                                        Tổng thuê bao
                                    </th>
                                    <th style="width: 11%">
                                        Số thuê bao H.Đ
                                    </th>
                                    <th style="width: 11%">
                                        Số thuê bao Khóa
                                    </th>
                                    <th style="width: 11%">
                                        Số thuê bao T.D
                                    </th>
                                    
                                </tr>
                            </thead>
                            <tbody>
                                @{int stt = 0;}
                                @foreach (var item in Model)
                                {
                                    stt++;
                                    <tr>
                                        <td class="align-center">@stt
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.ten_don_vi)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.system_id)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.name)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.ip)
                                        </td>
                                        <td>
                                            @{
                                                if (item.type_name == "5" || item.type_name == "6")
                                                {
                                                    <text>ATM</text>
                                                }
                                                else
                                                {
                                                    <text>IP</text>
                                                }
                                            }
                                           
                                        </td>
                                        <td>
                                            <a href="@Url.Action("DetailDslamPort", new { status = -1, quan_huyen_id = item.quan_huyen_id, system_id = item.system_id, name = item.name })">@(Convert.ToInt32(item.sum_port_run) + Convert.ToInt32(item.sum_port_lock) + Convert.ToInt32(item.sum_port_stop))</a>
                                        </td>
                                        <td>
                                            <a href="@Url.Action("DetailDslamPort", new { status = 1, quan_huyen_id = item.quan_huyen_id, system_id = item.system_id, name = item.name })">@Html.DisplayFor(modelItem => item.sum_port_run)</a>
                                        </td>
                                        <td>
                                            <a href="@Url.Action("DetailDslamPort", new { status = 0, quan_huyen_id = item.quan_huyen_id, system_id = item.system_id, name = item.name })">@Html.DisplayFor(modelItem => item.sum_port_lock)</a>
                                        </td>
                                        <td>
                                            <a href="@Url.Action("DetailDslamPort", new { status = 2, quan_huyen_id = item.quan_huyen_id, system_id = item.system_id, name = item.name })">@Html.DisplayFor(modelItem => item.sum_port_stop)</a>
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="pager" id="pager">
                    <div>
                        <img class="first" src="@Url.Content("~/Content/Body/Images/arrow-stop-180.gif")"  alt="first"/>
                        <img class="prev" src="@Url.Content("~/Content/Body/Images/arrow-180.gif")" alt="prev"/>
                        <input type="text" class="pagedisplay input-short align-center" />
                        <img class="next" src="@Url.Content("~/Content/Body/Images/arrow.gif")" alt="next"/>
                        <img class="last" src="@Url.Content("~/Content/Body/Images/arrow-stop.gif")" alt="last"/>
                        <select class="pagesize input-short align-center">
                            <option value="20" selected="selected">20</option>
                            <option value="30">30</option>
                            <option value="40">40</option>
                        </select>
                    </div>
                </div>
                <div style="clear: both">
                </div>
            </div>
            <!-- End .module-table-body -->
        </div>
    </div>
    <div style="clear: both;">
    </div>
</div>
<!-- End .container_12 -->
<script type="text/javascript">
    $("#service_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getDVJson", "Report")',
            data: { dichvu_id: $("#service_id > option:selected").attr("value"), Order: "ID" },
            success: function (data) {
                var items = [];
                items.push("<option>---Chọn đề thi---</option>");
                $.each(data, function () {
                    items.push("<option value=" + this.Value + ">" + this.Text + "</option>");
                });
                $("#de_thi_id").html(items.join(' '));
            }
        })
    });
</script>
<script type="text/javascript">
    function goTo() {

    }
</script>
